<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="title">#{aqarMsgs.Aqarat_Building_CreateBuilding_PageTitle}}</ui:define>
		<ui:define name="manuBar">
			<ui:include src="/controlling/aqarat/aqaratMenu.xhtml" />
		</ui:define>

		<ui:define name="content">
			<h:form id="b_frm">

				<p:panel header="#{aqarMsgs.Aqarat_Building_CreateBuilding_BuildingDetails}">
					<h:panelGrid columns="2">
						<h:outputText value="#{aqarMsgs.Aqarat_Building_Name}" />
						<p:inputText value="#{buildingBean.building.name}" required="true"
								requiredMessage="Name is Required"/>

						<h:outputText value="#{aqarMsgs.Aqarat_Building_NumberOfFloors}" />
						<p:selectOneMenu id="floor"
							value="#{buildingBean.building.numberOfFloors}">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems value="#{buildingBean.floorList}" var="floor"
								itemLabel="#{floor}" itemValue="#{floor}" />
						</p:selectOneMenu>

						<h:outputText value="#{aqarMsgs.Aqarat_Building_Address}" />
						<p:inputTextarea value="#{buildingBean.building.address}"
							autoResize="false" maxlength="500" />
					</h:panelGrid>
					<p:dataTable id="apartmentd" value="#{buildingBean.apartmentList}"
						var="apartment">
					<f:facet name="header">
					<h:outputText value="#{aqarMsgs.Aqarat_Building_CreateBuilding_NumberOfApartmentsInOneFloor}" />
					</f:facet>
						<p:column headerText="#{aqarMsgs.Aqarat_Apartments_No}">
							<h:outputText value="#{apartment.no}" />
						</p:column>
						<p:column headerText="#{aqarMsgs.Aqarat_Apartments_Area}">
							<p:inputText value="#{apartment.area}" required="true"
								requiredMessage="#{aqarMsgs.Aqarat_Apartments_AreaRequired}"
								converterMessage="#{aqarMsgs.Aqarat_Apartments_AreaConverter}">
								<f:converter converterId="javax.faces.Double" />
							</p:inputText>
						</p:column>
						<p:column headerText="#{aqarMsgs.Aqarat_General_Options}">
						<p:commandButton value="#{aqarMsgs.Aqarat_General_Delete}" actionListener="#{buildingBean.deleteApartment(apartment)}" update="apartmentd " immediate="true"/>
						</p:column>
						<f:facet name="footer">
						<p:commandButton value="#{aqarMsgs.Aqarat_General_Add}" actionListener="#{buildingBean.addApartment}" update="apartmentd" immediate="true"/>
						</f:facet>
					</p:dataTable>
					<p:commandButton value="#{aqarMsgs.Aqarat_General_Save}" actionListener="#{buildingBean.saveBuilding}" 
					onstart="waiteDialog.show();" oncomplete="waiteDialog.hide();"
					update="msgs"/>
					<p:messages id="msgs"/>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
